/*
 * Copyright (C) 2014 Hortator
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
package emergence.entities.npc;

import emergence.entities.Mob;
import emergence.entities.MobClass.ChampionClass;
import emergence.entities.Player;
import emergence.entities.attribute.MobStatSet;
import emergence.game.level.Level;
import java.util.Random;

/**
 *
 * @author Nathan Templon
 */
public class WanderingNPC extends Mob {

    public WanderingNPC(Level level, Mob.MobSpriteSet spriteSet) {
        super(level, "Wandering NPC", new ChampionClass(1), new MobStatSet());

        loadSprites(spriteSet);
    }
    
    @Override
    public void tick() {
        super.tick();

        if (!combatTurnOver && !attacking) {
            this.attack(combat.getCombatants()[0]);
        }
//        if (!inCombat) {
//            Random gen = new Random();
//            boolean move = (gen.nextInt(100) == 0);
//
//            if (move) {
//                int randDir = gen.nextInt(4);
//                switch (randDir) {
//                    case 0:
//                        xa++;
//                        break;
//                    case 1:
//                        xa--;
//                        break;
//                    case 2:
//                        ya++;
//                        break;
//                    case 3:
//                        ya--;
//                        break;
//                }
//                if (((xa != 0) || (ya != 0)) && !moving) {
//                    move(xa, ya);
//                }
//            }
//        }
    }

    @Override
    public boolean isFriendsWith(Mob other) {
        return !(other instanceof Player);
    }
    
}
